package ysy.aspectj;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.os.Looper;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.example.mytest.R;

import ysy.aspectj.annotation.AspectJAnnotation;
import ysy.ioc.annotation.BindView;
import ysy.ioc.util.InjectUtils;

public class AspectjActivity extends AppCompatActivity implements View.OnClickListener{

    @BindView(R.id.tv1)
    TextView tv1;

    @BindView(R.id.tv2)
    TextView tv2;

    @BindView(R.id.tv3)
    TextView tv3;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_aspectj);
//        InjectUtils.inject(this);
        Thread thread = new Thread(){
            @Override
            public void run() {
                super.run();
                Looper.prepare();
                try {
                    sleep(5000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                Log.e("tag", "run: 睡眠结束了");

                Looper.loop();
            }
        };
        thread.start();

    }

    @Override
    public void onClick(View v) {
        setText(1111);
    }

    @AspectJAnnotation("setText11")
    public View setText(int c){
        tv1.setText("你好吗");
        return tv1;
    }
}